#ifndef SESSIONSTATE
#define SESSIONSTATE

//#include <app\states\statesFactory.h>

#define STATE_TYPE_ID 0
#define CONNECTION_STATE_TYPE_ID 1
#define MODEL_INFO_STATE_TYPE_ID 2
#define CACHE_STATE_TYPE_ID 3
#define TEXTURE_TILE_STATE_TYPE_ID 4
#define TERRAIN_TILE_STATE_TYPE_ID 5
#define VIEWING_PARAMETERS_STATE_TYPE_ID 6
#define MOVE_STATE_TYPE_ID 7
#define ROTATE_STATE_TYPE_ID 8

#define REGISTER_STATE(ID, classname) \
  namespace { \
    statesFactory &cf = statesFactory::instance(); \
    bool foo = cf.registerState(ID, classname::create); \
  }

#define GET_STATE(type, conn) static_cast<type *>(conn->getSession().getState(type::getClassTypeId()))
#define GET_SESSION_STATE(type, session) static_cast<type *>(session->getState(type::getClassTypeId()))

class session;

class sessionState {

  static int class_type_id;
  int type_id;

protected:

  session *parent;

public:

  static int getClassTypeId();
  virtual int getTypeId();

  void setParent(session *parent_);

  sessionState();
  sessionState(int _type_id);
  virtual ~sessionState();
};

#endif